﻿using System;
using Autodesk.Revit.UI;

namespace YJKArch.StatisticTable
{
	public class FastMaterialRequestHandler : IExternalEventHandler
	{
		public FastMaterialRequest Request
		{
			get
			{
				return this.m_request;
			}
		}

		public string GetName()
		{
			return "R2014 External Event Sample";
		}

		public void Execute(UIApplication uiapp)
		{
			try
			{
				switch (this.Request.Take())
				{
				case RequestId.None:
					return;
				case RequestId.SelectArea:
					FastMaterialDlgApp.m_MyForm.SelectStatisticArea();
					break;
				case RequestId.DrawGrid:
					FastMaterialDlgApp.m_MyForm.DrawGrid();
					break;
				case RequestId.ExportExl:
					FastMaterialDlgApp.m_MyForm.ExportExcel();
					break;
				}
			}
			catch
			{
				FastMaterialDlgApp.m_MyForm.Close();
			}
		}

		private FastMaterialRequest m_request = new FastMaterialRequest();
	}
}
